package de.sas.za_expression.tests;

import de.sas.za_expression.model.NestedExpression;
import de.sas.za_expression.model.NumberAttribut;
import de.sas.za_expression.model.SingleExpression;
import de.sas.za_expression.model.StringAttribut;
import de.sas.za_expression.model.Zelle;

public class TestMain {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		Zelle heinz = new Zelle("Person");
		StringAttribut nameHeinz = new StringAttribut("Name", "Heinz");
		NumberAttribut alterHeinz = new NumberAttribut("Alter", 67);
		heinz.addAttribut(alterHeinz);
		heinz.addAttribut(nameHeinz);
		
		Zelle paul = new Zelle("Person");
		StringAttribut namePaul = new StringAttribut("Name", "Paul");
		NumberAttribut alterPaul = new NumberAttribut("Alter", 40);
		paul.addAttribut(alterPaul);
		paul.addAttribut(namePaul);

		Zelle gerhard = new Zelle("Person");
		StringAttribut nameGerhard = new StringAttribut("Name", "Gerhard");
		NumberAttribut alterGerhard = new NumberAttribut("Alter", 40);
		gerhard.addAttribut(alterGerhard);
		gerhard.addAttribut(nameGerhard);

		try {
			SingleExpression eins = new SingleExpression(heinz, "Alter", ">", 30);
			SingleExpression zwei = new SingleExpression(paul, "Alter", ">", 30.0);
			SingleExpression drei = new SingleExpression(gerhard, "Name", "=", "Gerhard");
			
			NestedExpression nEins = new NestedExpression(eins, "xor", zwei);
			NestedExpression nZwei = new NestedExpression(nEins, "xor", drei);
			System.out.println(nZwei.evaluate());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

}
